/*
 * Class that stores data about a Player
 */

#ifndef __Player_H__
#define __Player_H__

#include <Ogre.h>
#include <NxOgre.h>

using namespace Ogre;
using namespace NxOgre;

#define P1SHOOTSTARTPOS Ogre::Vector3(-100,100,0)
#define P2SHOOTSTARTPOS Ogre::Vector3(100,100,0)

class Player
{
public:
	int	playerID;
	Ogre::String playerName;

	Ogre::Real health;
	int kills;
	int deaths;
	Ogre::Real jumpTimer;
	bool isJumping;
	Ogre::SceneNode* playerSceneNode;
	Ogre::Entity* playerEntity;
	NxOgre::Character* playerChar;

	Ogre::String wpnName;
	Ogre::Entity* wpnEntity;
	Ogre::SceneNode* wpnSceneNode;

	Ogre::AnimationState* charWalk;

	enum KeyPress
	{
		// Player controls
		UP = 0,
		DOWN = 1,
		LEFT = 2,
		RIGHT = 3,
		SHOOT = 4,
		JUMP = 5
	};

	//--//

	Player();
	~Player() {};

	void createPlayer(NxOgre::Scene* nxScene, int playerID, Vector3 pos);

	int getID(void) { return playerID; }
	Ogre::String getName(void) { return playerName; }	
	Ogre::Vector3 getPosition(void) { return playerChar->getGlobalPosition(); }
	Ogre::Quaternion getOrientation(void) { return playerChar->getGlobalOrientation(); }
	Ogre::SceneNode* getSceneNode(void) { return playerSceneNode; }
	Ogre::Entity* getEntity(void) { return playerEntity; }
	NxOgre::Character* getCharacter(void) { return playerChar; }

	void setName(Ogre::String name) { playerName = name; }
	void setPosition(Ogre::Vector3 newPos) { playerChar->setPosition(newPos); }
	void setOrientation(Ogre::Quaternion newOrient) { playerChar->setDirection(newOrient); }

	void update(const FrameEvent& evt, bool walkFront, bool walkBack);

	void keyPressed(KeyPress key);
	void reset();
	bool isDead() { return (health <= 0); }
};

#endif